﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ScoreMS.Views
{
    /// <summary>
    /// AddClass.xaml 的交互逻辑
    /// </summary>
    public partial class ClassAdd : Page
    {
        public ClassAdd()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 添加班级
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (txtClass_id.Text.Trim() == "" || txtClass_grade.Text.Trim() == "" || txtClass_institute_id.Text.Trim() == "")
            {
                MessageBox.Show("请填写完整！", "提示");
                return;
            }
            if (BLL.ClassBS.AddClass(new Model.Class()
                {
                    class_id = txtClass_id.Text.Trim(),
                    class_grade = txtClass_grade.Text.Trim(),
                    class_institute_id = txtClass_institute_id.Text.Trim()
                }))
            {
                MessageBox.Show("恭喜！添加成功！", "提示");
            }
            else
            {
                MessageBox.Show("添加失败！请确保输入数据正确！", "警告");
            }
        }
    }
}
